<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="result"></div>

<script>
    // Check browser support
    if (typeof(Storage) !== "undefined") {
        // Store
        localStorage.setItem("lastname", "Gates");
        // Retrieve
        document.getElementById("result").innerHTML = localStorage.getItem("lastname");
    } else {
        document.getElementById("result").innerHTML = "抱歉！您的浏览器不支持 Web Storage ...";
    }
</script>
<script type="text/javascript">

    if (localStorage.pagecount)
    {
        localStorage.pagecount=Number(localStorage.pagecount) +1;
    }
    else
    {
        localStorage.pagecount=1;
    }
    document.write("Visits: " + localStorage.pagecount + " time(s).");

</script>
</body>
</html>
